package cn.xiaopengstack.infrastructure.persistent.dao;

import cn.bugstack.middleware.db.router.annotation.DBRouter;
import cn.bugstack.middleware.db.router.annotation.DBRouterStrategy;
import cn.xiaopengstack.infrastructure.persistent.po.UserAwardRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
* @author jiangyangang
* @description 针对表【user_award_record_000(用户中奖记录表)】的数据库操作Mapper
* @createDate 2025-07-02 11:45:57
* @Entity cn.xiaopengstack.infrastructure.persistent.po.UserAwardRecord
*/
@Mapper
@DBRouterStrategy(splitTable = true)
public interface IUserAwardRecordDao {

    @DBRouter(key = "userId")
    int insertSelective(UserAwardRecord record);

    @DBRouter(key = "userId")
    int updateByPrimaryKeySelective(UserAwardRecord record);

    /**
     * 查询用户中奖的次数
     * @param userAwardRecord
     * @return
     */
    @DBRouter(key = "userId")
    int queryUserWinLotteryCount(UserAwardRecord userAwardRecord);

    /**
     * 更新状态
     * @param userAwardRecord
     */
    int updateByComplete(UserAwardRecord userAwardRecord);

    UserAwardRecord queryAwardRecordByOrderId(@Param("userId") String userId, @Param("orderId") String orderId);
}
